class Solution {
public:
    int accountBalanceAfterPurchase(int purchaseAmount) {
        if (purchaseAmount % 10 == 0)return 100 - purchaseAmount;
        int x = purchaseAmount / 10;
        int y = purchaseAmount % 10;
        return y >= 5 ? 100 - (x + 1) * 10 : 100 - x * 10;
    }
};